package com.jsptpd.smartauth.modules.business.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.jsptpd.smartauth.modules.business.dao.db1.LoginLockMapper;
import com.jsptpd.smartauth.modules.business.model.LoginLock;
import com.jsptpd.smartauth.modules.business.service.ILoginLockService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class LoginLockServiceImpl extends ServiceImpl<LoginLockMapper, LoginLock> implements ILoginLockService {

    @Autowired
    LoginLockMapper loginLockMapper;

    @Override
    public List<LoginLock> getByUserId(String userId) {
        Map<String,Object> map = new HashMap<>();
        map.put("USER_ID",userId);
        return loginLockMapper.selectByMap(map);
    }

    @Override
    public Integer removeByUserId(String userId) {
        Map<String,Object> map = new HashMap<>();
        map.put("USER_ID",userId);
        return loginLockMapper.deleteByMap(map);
    }

    @Override
    public Integer updateByUserId(LoginLock loginLock) {
        return loginLockMapper.updateById(loginLock);
    }

    @Override
    public Integer insertByUserId(LoginLock loginLock) {
        return loginLockMapper.insert(loginLock);
    }
}
